package main

import (
	"fmt"
	"os"
	"time"

	"github.com/eventials/go-tus"
)

func main() {
	// tusDo()
	chanDo()

}

func tusDo() {
	f, err := os.Open("./main.go")
	if err != nil {
		panic(err)
	}
	defer f.Close()
	// create the tus client.
	client, err := tus.NewClient("http://127.0.0.1:8080/big/upload/", nil)
	fmt.Println(err)
	// create an upload from a file.
	upload, err := tus.NewUploadFromFile(f)
	fmt.Println(err)
	// create the uploader.
	uploader, err := client.CreateUpload(upload)
	fmt.Println(err)
	// start the uploading process.
	fmt.Println(uploader.Upload())
}

func chanDo() {
	c := make(chan int, 1)
	go chanSend(c)
	<-c
	fmt.Println("2")

}

func chanSend(c chan int) {
	time.Sleep(time.Second * 5)
	// c <- 0
	fmt.Println("5")
}
